<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>查询跟踪服务--报关单查询</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'/>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <%@include file="/WEB-INF/pages/common/taglib.jsp" %>
    <%@include file="/WEB-INF/pages/common/common.jsp" %>
</head>
<body>
<div class="content content_frame">
    <h3 class="mainTitle"><img src="${basePath}/images/icon2.png"/>报关单查询</h3>
    </br>
    <ul class="contentNav dib-wrap">
        <li class="dib" id="btnSearch" defaultkey='13'>
            <a><i class='fa fa-search'></i>&nbsp;&nbsp;查&nbsp;询 </a>
        </li>
        <%--<li class="dib" id="btnModify">--%>
            <%--<a onclick="ClearAllInput('SearchTable')">--%>
                <%--<i class='icon-edit'></i>&nbsp;&nbsp;修&nbsp;改 </a>--%>
        <%--</li>--%>
        <li class="dib ">
            <a onclick="ClearAllInput('SearchTable')">
                <i class='fa fa-refresh'></i>&nbsp;&nbsp;重&nbsp;置 </a>
        </li>
    </ul>
    <br/>
    <table id="SearchTable" width="100%" class="table1">
        <tr>
            <td style="width: 25%;">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        申报单位代码
                                    </td>
                                    <td class="tdCss">
                                        <input type="text" datafield="SearchTable.agentCode"/>
                                    </td>

                                </tr>
                            </table>
                        </td>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        电商平台代码
                                    </td>
                                    <td class="tdCss">
                                        <input type="text" datafield="SearchTable.ebPlatId"/>
                                    </td>

                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        进出口类型
                                    </td>
                                    <td class="tdCss">
                                        <ui:tsingletableautocomplete
                                                keyFieldName="ieFlag"
                                                valueFieldName="ieFlagXXXX"
                                                tableName="DICT_ITEM"
                                                key="ITEM_KEY"
                                                value="ITEM_VALUE"
                                                groupId="ieType"/>
                                    </td>

                                </tr>
                            </table>
                        </td>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        贸易方式
                                    </td>
                                    <td class="tdCss">
                                        <ui:tsingletableautocomplete
                                                keyFieldName="tradeMode"
                                                valueFieldName="tradeModeXXXX"
                                                tableName="DICT_ITEM"
                                                key="ITEM_KEY"
                                                value="ITEM_VALUE"
                                                groupId="TRADE_MODE_QDC"/>
                                    </td>

                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        出境日期
                                    </td>
                                    <td class="tdCss">
                                        <input type='text' style="width: 100%;" class="Wdate"
                                               onclick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'ieDateEnd\')}'})"
                                               timeformat="YYYY-MM-DD" id="ieDateStart"
                                               datafield="SearchTable.ieDateStart"/>
                                    </td>

                                </tr>
                            </table>
                        </td>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss" style="text-align: center">
                                        至
                                    </td>
                                    <td class="tdCss">
                                        <input type='text' style="width: 100%;" class="Wdate"
                                               onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'ieDateStart\')}'})"
                                               timeformat="YYYY-MM-DD" id="ieDateEnd"
                                               datafield="SearchTable.ieDateEnd"/>
                                    </td>

                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        物流企业代码
                                    </td>
                                    <td class="tdCss">
                                        <input type="text" datafield="SearchTable.logiEnteCode"/>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td style="width: 50%;">
                            <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                <tr>
                                    <td class="titleCss">
                                        物流企业名称
                                    </td>
                                    <td class="tdCss">
                                        <input type="text" datafield="SearchTable.logiEnteName"/>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <div class="cl"></div>
    <br/>
    <table id="corptable">
    </table>
    <div id="corptablePage">
    </div>
</div>
<script type="text/javascript">
    function urlCode(cellvalue, options, rowObject) {
        var url = '${basePath}/declareDetail/declareDetail/' + rowObject.elistNo;
        return "<a class='btn-link' href=\"" + url + "\">" + "<span style='color:#00acec'>" + rowObject.elistNo + "</span></a>";
    }

    $(function () {
        $("#corptable").jqGrid({
            datatype: "json",
            url: $basePath + "/searchManage/customsDeclaration/queryDeclareList",
            colNames: ['id', '申报单位代码', '申报单位名称', '电商平台代码', '电商平台名称', '物流企业代码', '物流企业名称', '进出口类型', '贸易方式', '退换货标志', '运单号', '进境日期', '账册编号', '备注'],
            colModel: [{name: 'id', index: 'id', hidden: true}, {
                name: 'agentCode',
                index: 'agentCode'
            }, {name: 'agentName', index: 'agentName', width: 300}, {
                name: 'ebPlatId',
                index: 'ebPlatId'
            }, {name: 'ebPlatName', index: 'ebPlatName', width: 300}, {
                name: 'logiEnteCode',
                index: 'logiEnteCode'
            }, {name: 'logiEnteName', index: 'logiEnteName', width: 300}, {
                name: 'ieFlag',
                index: 'ieFlag',
                formatter: ieFlag
            }, {name: 'tradeMode', index: 'tradeMode', formatter: tradeMode}, {
                name: 'returnFlag',
                index: 'returnFlag',
                formatter: returnFlag
            }, {name: 'waybillId', index: 'waybillId'}, {name: 'ieDate', index: 'ieDate'}, {
                name: 'manualNo',
                index: 'manualNo'
            }, {name: 'note', index: 'note', width: 300}],
            viewrecords: true,
            autowidth: true,
            height: 'auto',
            shrinkToFit: false,
            autoScroll: true,
            rowNum: 10, //每页显示记录数
            rowList: [10, 20, 100], //可调整每页显示的记录数
            rownumbers: true,
            rownumWidth: 25,
            multiselect: true,
            pager: "#corptablePage", //分页工具栏
            sortname: "ieDate",
            sortorder: "desc",
            loadComplete: function () {
                var rowNum = $(this).jqGrid('getGridParam', 'records');
                if (rowNum <= 0) {
                    if ($(this).parent().children('.norecords').length == 0)
                        $(this).parent().append("<div class=\"norecords\">暂无数据！</div>");
                    $(this).parent().children('.norecords').show();
                } else {
                    $(this).parent().children('.norecords').hide();
                }

                $("#corptable").setGridWidth($(window).width() * 0.98);
                $(".ui-jqgrid tr.ui-row-ltr td").css('text-align', 'center');
            }
        });
    });

    function reloadGrid() {
        var jsonStr = customFormToData("SearchTable");
        $("#corptable").jqGrid('setGridParam', {
            url: $basePath + "/searchManage/customsDeclaration/queryDeclareList", postData: JSON.parse(jsonStr), //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    }

    $(function () {
        $("#btnSearch").bind("click", function () {
            reloadGrid();
        });

        $("#btnModify").bind("click", function () {
            var jsonArr = getId("corptable");
            if (1 != jsonArr.length) {
                ShowMessages("对不起,您只能选中一条记录", "系统提示", "msgwaring", null, 0);
            } else {
                location.href = '${basePath}/declareDetailQdc/declareDetail/' + jsonArr[0].id;
            }
        });
    });
</script>
</body>
</html>
